<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<style type="text/css">
		@import url('../css/main.css');
	</style>

	<title>How to install GNU+Linux on a libreboot system</title>
</head>

<body>
	<div id="pagetop" class="section">
		<h1>How to install GNU+Linux on a libreboot system</h1>
			<p>
				This section relates to preparing, booting and installing a
				GNU+Linux distribution on your libreboot system, using nothing more than a USB flash drive (and <i>dd</i>).
			</p>
			<ul>
                <li><a href="../distros">List of recommended GNU+Linux distributions</a></li>
				<li><a href="#prepare">Prepare the USB drive (in GNU+Linux)</a></li>
				<li><a href="#encryption">Installing GNU+Linux with full disk encryption</a></li>
				<li><a href="#debian_netinstall">Debian or Devuan net install?</a></li>
				<li><a href="#parse_isolinux">Booting ISOLINUX images (automatic method)</a></li>
				<li><a href="#manual_isolinux">Booting ISOLINUX images (manual method)</a></li>
				<li><a href="#troubleshooting">Troubleshooting</a></li>
			</ul>
			<p>
				<a href="./">Back to previous index</a>
			</p>
	</div>

	<div class="section">
		<p>
			<b>This section is only for the GRUB payload. For depthcharge (used on CrOS devices in libreboot), instructions
			have yet to be written in the libreboot documentation.</b>
		</p>
	</div>

	<div id="prepare" class="section">
		
		<h2>Prepare the USB drive (in GNU+Linux)</h2>

            <p>
                If you downloaded your ISO on an existing GNU+Linux system,
                here is  how to create the bootable GNU+Linux USB drive:
            </p>

			<p>
				Connect the USB drive. Check dmesg:<br/>
				<b>$ dmesg</b><br/>

				Check lsblk to confirm which drive it is:<br/>
				<b>$ lsblk</b>
			</p>

			<p>
				Check that it wasn't automatically mounted. If it was, unmount it. For example:<br/>
				<b>$ sudo umount /dev/sdX*</b><br/>
				<b># umount /dev/sdX*</b>
			</p>

			<p>
				dmesg told you what device it is. Overwrite the drive, writing your distro ISO to it with dd. For example:<br/>
				<b>$ sudo dd if=gnulinux.iso of=/dev/sdX bs=8M; sync</b><br/>
				<b># dd if=gnulinux.iso of=/dev/sdX bs=8M; sync</b>
			</p>
			
			<p>
				You should now be able to boot the installer from your USB drive. Continue reading, for
				information about how to do that.
			</p>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>
	
        <h2>Prepare the USB drive (in NetBSD)</h2>
            <p>
               <a href="https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/">This page</a>
               on the NetBSD website shows how to create a NetBSD bootable USB drive
               from within NetBSD itself. You should use the <em>dd</em> method
               documented there. This will also work with any GNU+Linux ISO image.
            </p>

        <h2>Prepare the USB drive (in FreeBSD)</h2>
            <p>
                <a href="https://www.freebsd.org/doc/handbook/bsdinstall-pre.html">This page</a>
                on the FreeBSD website shows how to create a bootable USB drive
                for installing FreeBSD. Use the <em>dd</em> on that page. You can
                also use the same instructions with any GNU+Linux ISO image..
            </p>

		<h2>Prepare the USB drive (in LibertyBSD or OpenBSD)</h2>

            <p>
                If you downloaded your ISO on a LibertyBSD or OpenBSD system,
                here is how to create the bootable GNU+Linux USB drive:
            </p>

			<p>
				Connect the USB drive. Check dmesg:<br/>
				<b>$ dmesg | tail</b><br/>

				Check to confirm which drive it is, for example, if you think its sd3:<br/>
				<b>$ disklabel sd3</b>
			</p>

			<p>
				Check that it wasn't automatically mounted. If it was, unmount it. For example:<br/>
				<b>$ doas umount /dev/sd3i</b><br/>
			</p>

			<p>
				dmesg told you what device it is. Overwrite the drive, writing the OpenBSD installer to it with dd. For example:<br/>
				<b>$ doas dd if=gnulinux.iso of=/dev/rsdXc bs=1M; sync</b><br/>
			</p>
			
			<p>
				You should now be able to boot the installer from your USB drive. Continue reading, for
				information about how to do that.
			</p>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>

	</div>

	<div id="encryption" class="section">

		<h2>Installing GNU+Linux with full disk encryption</h2>

			<ul>
				<li><a href="encrypted_debian.html">Installing Debian or Devuan GNU+Linux with full disk encryption (including /boot)</a></li>
				<li><a href="encrypted_parabola.html">Installing Parabola GNU+Linux with full disk encryption (including /boot)</a></li>
			</ul>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>

	</div>
		
	<div id="debian_netinstall" class="section">

		<h2>Debian or Devuan net install?</h2>

			<p>
                Download the Debian or Devuan net installer. You can download the ISO from the homepage on
                <a href="https://www.debian.org/">debian.org</a>, or <a href="https://www.devuan.org/">the Devuan homepage</a> for Devuan.
                Use this on the GRUB terminal to boot it from USB (for 64-bit Intel or AMD):<br/>
                <strong>
                set root='usb0'<br/>
                linux /install.amd/vmlinuz<br/>
                initrd /install.amd/initrd.gz<br/>
                boot<br/>
                </strong>
                If you are on a 32-bit system (e.g. X60):<br/>
                <strong>
                set root='usb0'<br/>
                linux /install.386/vmlinuz<br/>
                initrd /install.386/initrd.gz<br/>
                boot
                </strong>
                <br/>
                We recommend using the <em>MATE</em> desktop.
			</p>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>

	</div>

	<div id="parse_isolinux" class="section">
		
		<h2>Booting ISOLINUX images (automatic method)</h2>

			<p>
				Boot it in GRUB using the <i>Parse ISOLINUX config (USB)</i> option.

				A new menu should appear in GRUB, showing the boot options for that distro; this is a GRUB menu, converted from the usual
				ISOLINUX menu provided by that distro.
			</p>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>
			
	</div>
		
	<div id="manual_isolinux" class="section">
		
		<h2>Booting ISOLINUX images (manual method)</h2>

			<p>
				<i>These are generic instructions. They may or may not be correct for your
				distribution. You must adapt them appropriately, for whatever GNU+Linux distribution
				it is that you are trying to install.</i>
			</p>

			<p>
				If the ISOLINUX parser or <i>Search for GRUB configuration</i> options won't work, then press C in GRUB to access the command line.<br/>
					grub&gt; <b>ls</b><br/>

				Get the device from above output, eg (usb0). Example:<br/>
					grub&gt; <b>cat (usb0)/isolinux/isolinux.cfg</b><br/>

				Either this will show the ISOLINUX menuentries for that ISO, or link to other .cfg files, for example /isolinux/foo.cfg.<br/>

				If it did that, then you do:<br/>
					grub&gt; <b>cat (usb0)/isolinux/foo.cfg</b><br/>

				And so on, until you find the correct menuentries for ISOLINUX.
				<b>The file <i>/isolinux/foo.cfg</i> is a fictional example. Do not actually
				use this example, unless you actually have that file, if it is appropriate.</b>
			</p>

			<p>
				For Debian or Devuan (and other debian-based distros), there are typically menuentries listed in
				<i>/isolinux/txt.cfg</i> or <i>/isolinux/gtk.cfg</i>. For dual-architecture ISO images
				(i686 and x86_64), there may be separate files/directories for each architecture.
				Just keep searching through the image, until you find the correct ISOLINUX configuration file.
                NOTE: Debian 8.6 ISO only lists 32-bit boot options in txt.cfg. This is important if you want
                64-bit booting on your system. Devuan versions based on Debian 8.x may also have the same
                issue.
			</p>

			<p>
				Now look at the ISOLINUX menuentry. It'll look like:<br/>
				<b>
					kernel /path/to/kernel<br/>
					append PARAMETERS initrd=/path/to/initrd MAYBE_MORE_PARAMETERS<br/>
				</b>

				GRUB works the same way, but in it's own way. Example GRUB commands:<br/>
					grub&gt; <b>set root='usb0'</b><br/>
					grub&gt; <b>linux /path/to/kernel PARAMETERS MAYBE_MORE_PARAMETERS</b><br/>
					grub&gt; <b>initrd /path/to/initrd</b><br/>
					grub&gt; <b>boot</b><br/>
				Note: <i>usb0</i> may be incorrect. Check the output of the <i>ls</i> command in GRUB,
				to see a list of USB devices/partitions.

				Of course this will vary from distro to distro. If you did all of that correctly, then it should now be booting your USB
				drive in the way that you specified.
			</p>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>
			
	</div>

	<div id="troubleshooting" class="section">
		
		<h1>Troubleshooting</h1>

			<p>
				Most of these issues occur when using libreboot with coreboot's 'text mode' instead of the coreboot framebuffer.
				This mode is useful for booting payloads like memtest86+ which expect text-mode, but for GNU+Linux distributions
				it can be problematic when they are trying to switch to a framebuffer because it doesn't exist.
			</p>

			<p>
				In most cases, you should use the vesafb ROM images. Example filename: libreboot_ukdvorak_vesafb.rom.
			</p>

			<h2>parabola won't boot in text-mode</h2>

				<p>
					Use one of the ROM images with vesafb in the filename (uses coreboot framebuffer instead of text-mode).
				</p>

			<h2>debian-installer graphical corruption in text-mode (Debian and Devuan)</h2>
				<p>
					When using the ROM images that use coreboot's &quot;text mode&quot; instead of the coreboot framebuffer,
					booting the Debian or Devuan net installer results in graphical corruption because it is trying to switch to a framebuffer which doesn't
					exist. Use that kernel parameter on the 'linux' line when booting it:<br/>
					<b>vga=normal fb=false</b>
				</p>

				<p>
					This forces debian-installer to start in text-mode, instead of trying to switch to a framebuffer.
				</p>

				<p>
					If selecting text-mode from a GRUB menu created using the ISOLINUX parser, you can press E on the menu entry to add this.
					Or, if you are booting manually (from GRUB terminal) then just add the parameters.
				</p>

				<p>
					This workaround was found on the page: <a href="https://www.debian.org/releases/stable/i386/ch05s04.html">https://www.debian.org/releases/stable/i386/ch05s04.html</a>.
					It should also work for Debian, Devuan and any other apt-get distro that provides debian-installer (text mode) net install method.
				</p>

			<p>
				<a href="#pagetop">Back to top of page</a>.
			</p>
				
	</div>

	<div class="section">

		<p>
			Copyright &copy;  2014, 2015, 2016 Leah Rowe &lt;info@minifree.org&gt;<br/>
			Copyright &copy;  2016 Scott Bonds &lt;scott@ggr.com&gt;<br/>
			Permission is granted to copy, distribute and/or modify this document
			under the terms of the Creative Commons Attribution-ShareAlike 4.0 International license
			or any later version published by Creative Commons;
			
			A copy of the license can be found at <a href="../cc-by-sa-4.0.txt">../cc-by-sa-4.0.txt</a>
		</p>

		<p>
			Updated versions of the license (when available) can be found at
			<a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode">https://creativecommons.org/licenses/by-sa/4.0/legalcode</a>
		</p>

		<p>
			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
		</p>
		<p>
			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
		</p>
		<p>
			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.
		</p>
		
	</div>

</body>
</html>
